<div class="khfiles index">
<p>
<?php
echo  __('Hiện có '.count($khfiles).' thông báo và tập tin đính kèm', true);
?></p>
<table cellpadding="0" cellspacing="0" id="tables">
<tr>
	<th><?php echo 'STT';?></th>
	<th><?php echo 'Ðơn vị';?></th>
	<th><?php echo 'Tiêu đề';?></th>
	<th><?php echo 'Nội dung';?></th>
	<th><?php echo 'Thời gian upload';?></th>
	<th><?php echo 'Tên file';?></th>
	
	<th><?php echo 'Loại tập tin';?></th>
	<th><?php echo 'Độ lớn (KB)'?></th>
    <th colspan="2" class="actions"><?php __('Hành động');?></th>
    
</tr>
<?php
$i = 0;
foreach ($khfiles as $khfile):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
		<td>
			<?php echo $i//echo $khfile['Khfile']['id']; ?>
		</td>
		<td>
			<?php echo $html->link($khfile['Donvi']['tendonvi'], array('controller' => 'donvis', 'action' => 'view', $khfile['Donvi']['id'])); ?>
		</td>
		<td>
			<?php echo $khfile['Khfile']['tieude']; ?>
		</td>
		<td>
			<?php echo $khfile['Khfile']['noidung']; ?>
		</td>
	
		<td>
			<strong><?php echo date('d-m-Y h\hm',strtotime($khfile['Khfile']['ngaytao'])); ?></strong>
		</td>
		<td>
			<?php echo $khfile['Khfile']['tenfile']; ?>
		</td>
		
		<td>
			<?php echo $khfile['Khfile']['kieu']; ?>
		</td>
		<td>
		<?php echo number_format($khfile['Khfile']['dolon']/1024,2,'.',','); ?>
		</td>
		<td class="actions">
			<?php echo $html->link(__('Xem', true), array('action' => 'view', $khfile['Khfile']['id'])); ?>
            
            <?php if($nv_id==$khfile['Khfile']['nhanvien_id']) {?>
			<?php echo $html->link(__('Sửa', true), array('action' => 'edit', $khfile['Khfile']['id'])); ?>
			<?php echo $html->link(__('Xóa', true), array('action' => 'delete', $khfile['Khfile']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $khfile['Khfile']['id'])); ?>
            <?php }?>
		</td>
        <td>
			<?php 
           
            // echo $html->link('Download', $webroot('files'.DS.$khfile['Khfile']['tenfileserver']));
             //   echo '<a href="http:\\\\'.WWW_ROOT.'files\\'.$khfile['Khfile']['tenfileserver'].'">Download'.'</a>';
            echo $html->link(__('Download', true), array(
                 'action' => 'download',                
                 $khfile['Khfile']['id']
            ));


//echo $khfile['Khfile']['tenfileserver']; ?>
        
		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>